//
//  FirstPageRankingTableViewCell.m
//  BSLCar
//
//  Created by 梁毅 on 15/5/25.
//  Copyright (c) 2015年 lyz. All rights reserved.
//

#import "FirstPageRankingTableViewCell.h"

@implementation FirstPageRankingTableViewCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createCell];
        self.selectionStyle = UITableViewCellSeparatorStyleNone;
    }
    return self;
}
- (void)createCell
{
    self.labelName1 = [[UILabel alloc]init];
    [self.contentView addSubview:self.labelName1];
    self.priceLabel  = [[UILabel alloc]init];
    [self.contentView addSubview:self.priceLabel];
    self.countLabel = [[UILabel alloc]init];
    [self.contentView addSubview:self.countLabel];
    self.mimageview = [[UIImageView alloc]init];
    [self.contentView addSubview:self.mimageview];
    self.button = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.contentView addSubview:self.button];
}
- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.labelName1.frame = CGRectMake(110, 20, self.bounds.size.width - 125, 20);
    self.labelName1.adjustsFontSizeToFitWidth = YES;
    
    self.priceLabel.frame = CGRectMake(110, 55, self.bounds.size.width - 125, 20);
    self.priceLabel.textColor = [UIColor redColor];
    self.priceLabel.adjustsFontSizeToFitWidth = YES;
    
    self.countLabel.frame = CGRectMake(110, 70, self.bounds.size.width - 120, 20);
    self.countLabel.textAlignment = NSTextAlignmentRight;
//    self.countLabel.adjustsFontSizeToFitWidth = YES;
    self.countLabel.font = [UIFont systemFontOfSize:14];
    self.countLabel.textColor = [UIColor grayColor];
    
    self.mimageview.frame = CGRectMake(5, 5, 100, 85);
    self.mimageview.layer.cornerRadius = 3;
    self.mimageview.layer.masksToBounds = YES;
    
    self.button.frame = CGRectMake(self.bounds.size.width - 40, 20, 30, 30);
    [self.button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    self.button.titleLabel.font = [UIFont systemFontOfSize:12];
    self.button.titleEdgeInsets = UIEdgeInsetsMake(-8, -27, 0, 0);
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
